package com.yyuap.nativeweb;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import com.yonyou.uap.um.core.UMActivity;

public class SettingActivity extends UMActivity implements View.OnClickListener {
	public static final String DEFAULT_PORT = "8888";
	EditText tip = null;
	EditText tport = null;

	private void saveConfigure() {
		SharedPreferences.Editor localEditor = getSharedPreferences(
				"umservice_configure", 0).edit();
		localEditor.putString("nwip", this.tip.getText().toString());
		localEditor.putString("nwport", this.tport.getText().toString());
		localEditor.commit();
	}

	public String getContextName() {
		return null;
	}

	public void onClick(View paramView) {
		if (paramView.getId() == R.id.btnSave) {
			saveConfigure();
			finish();
		}
		if (paramView.getId() == R.id.btnClose)
			finish();
	}

	protected void onCreate(Bundle paramBundle) {
		super.onCreate(paramBundle);
		setContentView(R.layout.setting);
		findViewById(R.id.btnSave).setOnClickListener(this);
		findViewById(R.id.btnClose).setOnClickListener(this);
		this.tip = ((EditText) findViewById(R.id.txtIp));
		this.tport = ((EditText) findViewById(R.id.txtPort));
		SharedPreferences s = getSharedPreferences("umservice_configure", 0);
		this.tip.setText(s.getString("nwip", ""));
		this.tport.setText(s.getString("nwport", "8888"));
	}

	public void onInit(Bundle paramBundle) {
	}
}
